package com.Homework2;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;

public class Test07 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"abc","bcd");
        HashMap<Character, Integer> map = new HashMap<>();
        for (String s : list) {
            char[] chars = s.toCharArray();
            for (char aChar : chars) {//拿到字符串的每个元素
                if(!map.containsKey(aChar)){
                    map.put(aChar,1);
                }else{
                    Integer o = map.get(aChar);
                    map.put(aChar,++o);
                }
            }
        }
        System.out.println(map);
    }
}
